import React from 'react'
interface ClickFunc {
  (params?:any): void
}
interface Prop {
  name: string;
  color?: string;
  size?: number,
  onClick?: ClickFunc,
  stop?: boolean
}
function Icon(props: Prop) {
  return (
    <i className={'iconfont icon-' + props.name} style={{
      color: props.color,
      fontSize: props.size
    }}
    onClick={
      (e) => {
        props.onClick && props.onClick();
        props.stop && e.stopPropagation()
      }
    }
    ></i>
  )
}
Icon.defaultProps = {
  color: '#333',
  size: 16,
  onClick: () => {

  },
  stop: false
}
export default Icon